feat: add missing SAFE_ERROR_CODES for rate limiting and auth errors#980
Merged
pyramation merged 2 commits intomainfrom Apr 16, 2026
Merged
feat: add missing SAFE_ERROR_CODES for rate limiting and auth errors#980pyramation merged 2 commits intomainfrom
pyramation merged 2 commits intomainfrom
Conversation
Add error codes that are raised by constructive-db deployed functions but were missing from the production error masking allowlist: - IP_RATE_LIMITED (new — from rate_limits_module IP throttling) - PASSWORD_RESET_LOCKED_EXCEED_ATTEMPTS (password reset lockout) - CSRF_TOKEN_REQUIRED, INVALID_CSRF_TOKEN (CSRF validation) - TOTP_NOT_ENABLED (TOTP verification) - NULL_VALUES_DISALLOWED (reset_password validation) - OBJECT_NOT_FOUND (invite/object lookups) - LIMIT_REACHED (membership/invite limits) - REQUIRES_ONE_OWNER (ownership constraints) Without these, production clients would receive masked 'INTERNAL_SERVER_ERROR' instead of the actionable error codes.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 11 new error codes to the
SAFE_ERROR_CODESallowlist in the GraphQL middleware. Without this change, these database-raised errors are masked as generic "Internal Server Error" responses in production, preventing clients from handling them appropriately.This is a companion change to constructive-db#800, which adds a
rate_limits_modulewith IP-based rate limiting and moves login throttle configuration to a dedicated settings table.Updates since last revision
IP_RATE_LIMITED→TOO_MANY_REQUESTS— more generic error code that doesn't leak the rate limiting mechanism (aligns with HTTP 429 semantics). Updated in both this PR and constructive-db#800.New error codes by category:
CSRF_TOKEN_REQUIRED,INVALID_CSRF_TOKENTOO_MANY_REQUESTS,PASSWORD_RESET_LOCKED_EXCEED_ATTEMPTSTOTP_NOT_ENABLEDNULL_VALUES_DISALLOWED,OBJECT_NOT_FOUND,LIMIT_REACHED,REQUIRES_ONE_OWNERReview & Testing Checklist for Human
TOO_MANY_REQUESTSexactly matches theRAISEin constructive-db#800 — the rename fromIP_RATE_LIMITEDwas done in both repos; confirm the strings are identical (grep forraise_exception('TOO_MANY_REQUESTS')inast_plpgsql_helpers/procedures/statements.sql).rate_limits_modulegenerators in constructive-db#800 for anyRAISEstatements whose codes are not yet in this allowlist.Notes
TOO_MANY_REQUESTSand this PR ensures it passes through to clients instead of being masked.Link to Devin session: https://app.devin.ai/sessions/9034e6efc9bb45b8999b0269a5cd8231
Requested by: @pyramation